home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* HelpWindowProc */
- /************************************************************************************/
-
- #include "MyHeaders.h"
-
- short HelpWindowProc()
- {
- short HelpWindRetCode = 0;
- short workPart;
- short h,v;
- Rect sizeRect;
- ControlHandle workControlHandle;
-
- SetPort (windTbl[1].windPtr); /* set as the grafPort */
-
- workPoint = myEvent.where;
- GlobalToLocal(&workPoint);
-
- switch (myEvent.what) /* how did I get here? */
- {
- case (mouseDown): /* MouseDown? */
- switch (myMouseWhere) /* What part of window? */
- {
- case (inContent): /* content region: */
- workRect = (**helpList).rView; /* view area of list */
- workRect.right += 16; /* plus scroll bar */
- if (PtInRect(workPoint, &workRect)) /* if in the list area */
- {
- workBoolean = LClick (workPoint, myEvent.modifiers, helpList);
-
- for (j=0; j<helpCount; j++) /* find which cell is on */
- {
- helpCell.h = 0;
- helpCell.v = j;
- if (LGetSelect(FALSE, &helpCell, helpList))
- break;
- }
-
- if ((helpCell.v != helpPrev)
- && (j < helpCount))
- {
- helpPrev = helpCell.v;
- helpHandle = GetResource('TEXT', 7700 + helpCell.v);
- HLock (helpHandle);
- helpLong = SizeResource(helpHandle);
- EraseRect (&(**windTbl[1].windTEH[0]).viewRect);
- TESetText (*helpHandle+32, helpLong-32,
- windTbl[1].windTEH[0]);
- HUnlock (helpHandle);
- ReleaseResource (helpHandle);
- TECalText (windTbl[1].windTEH[0]);
- if ((**windTbl[1].windCntlH[0]).contrlValue > 0)
- TEScroll (0, (**windTbl[1].windCntlH[0]).contrlValue,
- windTbl[1].windTEH[0]);
- myActionProc (windTbl[1].windCntlH[0], 0);
- InvalRect (&(**windTbl[1].windTEH[0]).viewRect);
- }
- }
- else
- {
- workPart = FindControl (workPoint, /* check for control*/
- windTbl[1].windPtr,
- &workControlHandle);
- if (workPart) /* if so, track it */
- {
- if (workPart != inThumb) /* if not in thumb: my proc */
- /* to scroll and reset thumb */
- /* on the basis of the scroll */
- TrackControl (workControlHandle, workPoint,
- (ProcPtr) -1);
-
- else /* in thumb: use native routine */
- { /* then invoke my proc to */
- /* scroll on the basis of thumb */
- k = GetCtlValue (workControlHandle);
- TrackControl (workControlHandle, workPoint, NIL);
- k -= GetCtlValue (workControlHandle);
- myActionProc(workControlHandle, (short) workPart);
- }
- }
- }
- break;
-
- case (inDrag): /* drag region: */
- DragWindow (windTbl[1].windPtr,
- myEvent.where, &myDragRect);
- break;
-
- case (inGoAway): /* goaway region: */
- if (TrackGoAway (windTbl[1].windPtr, myEvent.where))
- WorkRetCode = HelpCloseProc();
- break;
- }
-
- break;
-
- case (activateEvt):
- j = (short) BitAnd(myEvent.modifiers, activeFlag);
-
- if (j) /* if activate... */
- {
- WorkRetCode = MenuUpdate(ProcHelp); /* set menus */
- ShowControl (windTbl[1].windCntlH[0]);
- HiliteControl (windTbl[1].windCntlH[0], 0);
- LActivate (TRUE, helpList);
- }
- else /* if deactivate... */
- {
- HiliteControl (windTbl[1].windCntlH[0], 255); /* unhilite */
- HideControl (windTbl[1].windCntlH[0]); /* hide (to match L/M) */
- LActivate (FALSE, helpList);
- }
- break;
- }
-
- return HelpWindRetCode;
- }
-